#include "Utility.h"

//returns a string version of the integer parameter
std::string Utility::toString(int x){
    std::string s1;
    std::stringstream out;
    out << x;
    return out.str();
}

// returns a random int between min and max
int Utility::random(int min, int max) //range : [min, max)
{
   static bool first = true;
   if ( first )
   {
      srand(time(NULL)); //seeding for the first time only!
      first = false;
   }
   return min + rand() % (max - min);
}

float Utility::getDistance(float x1, float y1, float x2, float y2){

    return  std::sqrt(pow((x2-x1),2) + pow((y2-y1),2));

}


